<?php

/**
 * This is the model class for table "prefix_reminder".
 *
 * The followings are the available columns in table 'prefix_reminder':
 * @property string $reminder_code
 * @property string $user_id
 * @property string $reminder_date_add
 * @property string $reminder_date_used
 * @property string $reminder_date_expire
 * @property integer $reminde_is_used
 * @property User $user
 */
class Reminder extends LsActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Reminder the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return Config::Get('db.table.reminder');
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('reminder_code, user_id, reminder_date_add, reminder_date_expire', 'required'),
			array('reminde_is_used', 'numerical', 'integerOnly'=>true),
			array('reminder_code', 'length', 'max'=>32),
			array('user_id', 'length', 'max'=>11),
			array('reminder_date_used', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('reminder_code, user_id, reminder_date_add, reminder_date_used, reminder_date_expire, reminde_is_used', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'user' => array(self::BELONGS_TO, 'User', 'user_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'reminder_code' => 'Reminder Code',
			'user_id' => 'User',
			'reminder_date_add' => 'Reminder Date Add',
			'reminder_date_used' => 'Reminder Date Used',
			'reminder_date_expire' => 'Reminder Date Expire',
			'reminde_is_used' => 'Reminde Is Used',
		);
	}
}